from page.main_page import MainPage
from common.page import IOS
from time import sleep


class FocusProjectPage(MainPage):

    tools_outside = ["培训任务", "考勤", "课程", "文章", "资源","调研","作业","研讨"]

    def enter_tools(self, tools_name):
        self.swipe_dr('up')
        if tools_name == '研修圈':
            self.find_button(string="研修圈",contains_flag=1).click()
        else:
            if tools_name not in self.tools_outside:
                self.find_button('查看详情 >').click()
                sleep(1)
            # self.find_element(IOS, "type == 'XCUIElementTypeStaticText' AND label CONTAINS '%s'" % tools_name).click()
            ele = (IOS, "type == 'XCUIElementTypeStaticText' AND label CONTAINS '%s'" % tools_name)
            self.get_frame_center_and_click(ele)

    def enter_notebook(self):
        self.find_button('通讯录').click()

    def enter_suggestion(self):
        self.find_button("用户反馈").click()
